package com.how2java.tmall.service;

import com.how2java.tmall.dao.FavoriteDao;
import com.how2java.tmall.pojo.Favorite;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class FavoriteService {
    @Autowired
    FavoriteDao favoriteDao;

    public void add(Favorite favorite) {
        log.info("进入FavoriteService=--=--=add()");
        favoriteDao.save(favorite);
    }

    public List<Favorite> findByGoodsIdAndUserId(Integer pid, int userId) {
        return favoriteDao.findByGoodsIdAndUserId(pid, userId);

    }
}
